import { Transform, TransformFnParams } from "class-transformer";
import { IsNotEmpty, IsString } from "class-validator";
import IUser from "./user.interface";

/**
 * 登录需要email 和 密码
 */
class LoginDto implements Pick<IUser, "email" | "password"> {
  @IsString()
  @IsNotEmpty()
  @Transform(({ value }: TransformFnParams) => value.trim())
  email: string;
  @IsString()
  @IsNotEmpty()
  @Transform(({ value }: TransformFnParams) => value.trim())
  password: string;
}

export default LoginDto;
